#!/bin/sh

set -e

SYS_APACHE_PATH="/home/gift_apache2.2"
BIN_PATH="$SYS_APACHE_PATH/bin"
COMMAND="$BIN_PATH/apachectl"
CONF_PATH="$SYS_APACHE_PATH/conf/extra"

start_apache(){
	exec $COMMAND start
}

stop_apache(){
	exec $COMMAND stop
}

restart_apache(){
	exec $COMMAND restart
}

see_conf(){
	vim "$CONF_PATH/httpd-vhosts.conf"
}

case $1 in
	start) start_apache
	;;

	stop) stop_apache
	;;

	re) restart_apache
	;;

	conf) see_conf
	;;

	*)
		echo "unknow command"
		echo "usage:"
		echo "./ra.sh start|stop|restart|conf"
		exit 0
	;;
esac
